# Template file for 'inkscape'
pkgname=inkscape
version=1.2
revision=1
wrksrc="inkscape-${version}_2022-05-15_dc2aedaf03"
build_style=cmake
# builds executables then runs checks
# some tests still fail on musl: https://gitlab.com/inkscape/inkscape/-/issues/2241
make_check_target=check
hostmakedepends="automake pkg-config libtool intltool gettext
 glib-devel perl-XML-Parser which"
makedepends="harfbuzz-devel libsoup-devel gsl-devel pango-devel libatomic_ops-devel
 double-conversion-devel gc-devel libwpd-devel libcdr-devel libvisio-devel
 poppler-devel libwpd-devel potrace-devel gtkmm-devel gdl-devel gtkspell3-devel
 aspell-devel libxslt-devel libgomp-devel libwpg-devel poppler-glib-devel"
depends="desktop-file-utils hicolor-icon-theme python3-appdirs python3-lxml python3-numpy
 python3-scour python3-Pillow"
checkdepends="$depends gtest-devel ImageMagick cantarell-fonts"
short_desc="Vector-based drawing program"
maintainer="Alex Lohr <alex.lohr@logmein.com>"
license="GPL-2.0-only, LGPL-2.1-or-later"
homepage="http://inkscape.org/"
distfiles="https://media.inkscape.org/dl/resources/file/inkscape-${version}.tar.xz"
checksum=8d9b31142554945664edfefe2d6b55910a5099765f7176a71107c34f1dcde6ad
python_version=3

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	makedepends+=" libatomic-devel"
fi

post_patch() {
	if [ "$XBPS_TARGET_LIBC" = musl ]; then
		# disable errors for missing sentinels in glib variadic functions,
		# since inkscape uses NULL instead of nullptr
		vsed -e "/-Werror=format/d" -i CMakeScripts/DefineDependsandFlags.cmake
	fi
	# disable glyph tests that fail due to different hinting
	vsed -e \
		"s/\(test-glyph-y-pos\|test-rtl-vertical\|text-glyphs-combining\|text-glyphs-vertical\)/# \1 - skipped due to hinting issues/" \
		-i testfiles/rendering_tests/CMakeLists.txt
}
